package com.design.pattern.structure.proxy.jdkproxy;

import sun.misc.ProxyGenerator;

import java.io.FileOutputStream;
import java.io.IOException;

public class Test {
    public static void main(String[] args) throws IOException {
        JdkMeipo meipo = new JdkMeipo();
        IPerson zhangsan = (IPerson) meipo.getInstance(new Zhangsan());
        zhangsan.findLove();


        byte[] bytes = ProxyGenerator.generateProxyClass("$Proxy0", new Class[]{IPerson.class});
        FileOutputStream fos = new FileOutputStream("$Proxy0.class");
        fos.write(bytes);
        fos.flush();
        fos.close();
    }
}
